package beacon;

import aggressor.AggressorClient;
import beacon.remoteexploits.PsExec;
import beacon.remoteexploits.PsExecPowerShell;
import beacon.remoteexploits.WinRM;

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class BeaconRemoteExploits {
    public Map descriptions = new HashMap();

    public Map exploits = new HashMap();

    public Map archs = new HashMap();

    public void registerDefaults(AggressorClient aggressorClient) {
        new PsExec(aggressorClient, "x86");
        new PsExec(aggressorClient, "x64");
        new PsExecPowerShell(aggressorClient);
        new WinRM(aggressorClient, "x86");
        new WinRM(aggressorClient, "x64");
    }

    public RemoteExploit getRemoteExploit(String string) {
        synchronized (this) {
            return (RemoteExploit) this.exploits.get(string);
        }
    }

    public void register(String string1, String string2, String string3, RemoteExploit paramRemoteExploit) {
        synchronized (this) {
            this.descriptions.put(string1, string3);
            this.exploits.put(string1, paramRemoteExploit);
            this.archs.put(string1, string2);
        }
    }

    public boolean isExploit(String string) {
        synchronized (this) {
            return this.exploits.containsKey(string);
        }
    }

    public List exploits() {
        synchronized (this) {
            LinkedList linkedList = new LinkedList(this.descriptions.keySet());
            Collections.sort(linkedList);
            return linkedList;
        }
    }

    public String getArch(String string) {
        synchronized (this) {
            return this.archs.get(string) + "";
        }
    }

    public String getDescription(String string) {
        synchronized (this) {
            return this.descriptions.get(string) + "";
        }
    }

    public static interface RemoteExploit {
        void jump(String string1, String string2, String string3);
    }
}
